<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>动画与过渡的区别</title>
    <style>
      .outer {
        width: 800px;
        height: 200px;
        border: 1px solid black;
        text-align: center;
      }
      .inner {
        width: 100px;
        height: 100px;
      }

      /* 过渡实现inner1 */
      .inner1 {
        background-color: orange;
        transition: all 2s linear;
      }

      .outer:hover .inner1 {
        transform: translate(800px);
      }

      .inner2 {
        background-color: skyblue;
        animation: aituigu 2s linear infinite alternate;
      }

      @keyframes aituigu {
        0% {
          transform: translate(0);
        }

        50% {
          background-color: red;
          border-radius: 50%;
        }

        100% {
          transform: translate(800px);
        }
      }
    </style>
  </head>
  <body>
    <div class="outer">
      <div class="inner inner1">过渡</div>
      <div class="inner inner2">动画</div>
    </div>
  </body>
</html>
